<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Install_model extends CI_Model {
	
	public function check_db($server, $username, $password, $database){
		error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
		$connection = mysql_connect($server, $username, $password);
		return $connection;
		if($connection)
		{
			return mysql_select_db($database, $connection);
		}else{
			return false;
		}
	}
	
	public function setDatabase($server, $username, $password, $database){
		if(!empty($server) AND !empty($username) AND !empty($password) AND !empty($database)){
			$data = array(
											'server'	=>	$server
										,	'username'	=>	$username
										,	'password'	=>	$password
										,	'database'	=>	$database
										);
			$this->session->set_userdata('database', $data);
			return true;
		}else{
			return false;
		}
	}
	
	public function setAdministrator($password, $email){
		if(!empty($password) AND !empty($email)){
			$data = array(
											'admin_password'	=>	$password
										,	'email'	=>	$email
										);
			$this->session->set_userdata('administrator', $data);
			return true;
		}else{
			return false;
		}
	}
	
	public function setSchool($schoolname, $schoolmail, $kbomail, $sender){
		if(!empty($schoolname) AND !empty($schoolmail) AND !empty($kbomail) AND !empty($sender)){
			$data = array(
											'schoolname'	=>	$schoolname
										,	'schoolmail'	=>	$schoolmail
										,	'kbomail'	=>	$kbomail
										,	'sender'	=>	$sender
										);
			$this->session->set_userdata('school', $data);
			return true;
		}else{
			return false;
		}
	}
	
}